# Office of Policy Development and Research dataset
# Location Affordability Index v.3
# https://hudgis-hud.opendata.arcgis.com/datasets/HUD::location-affordability-index-v-3/about
# load necessary packages
pacman::p_load(pacman, maps, mapdata, tidyverse, sm, grid)
# importing dataset
df_csv <- read.csv("~/Desktop/projects/Location_Affordability_Index_v.3.csv")
head(df_csv)
## OBJECTID GEOID STATE COUNTY TRACT CNTY_FIPS STUSAB households
## 1 1 1089010800 1 89 10800 1089 AL 3773
## 2 2 1089010701 1 89 10701 1089 AL 3217
## 3 3 1059973000 1 59 973000 1059 AL 1853
## 4 4 1059973200 1 59 973200 1059 AL 1262
## 5 5 1089010401 1 89 10401 1089 AL 2401
## 6 6 1089001000 1 89 1000 1089 AL 1615
## owner_occupied_hu renter_occupied_hu pct_renters pct_renter_occupied_hu
## 1 3335 438 10.94453 11.60880
## 2 2588 629 18.14772 19.55238
## 3 914 939 43.61356 50.67458
## 4 836 426 28.59060 33.75594
## 5 1937 464 18.59719 19.32528
## 6 864 751 38.93209 46.50155
## pct_transit_j2w_renters pct_transit_j2w_owners pct_transit_j2w
## 1 0 0 0
## 2 0 0 0
## 3 0 0 0
## 4 0 0 0
## 5 0 0 0
## 6 0 0 0
## median_smoc_mortgage median_gross_rent avg_h_cost autos_per_hh_renters
## 1 1237 879 1195.4405 1.657534
## 2 1258 738 1156.3276 1.775835
## 3 737 622 678.7242 1.708200
## 4 834 533 732.3946 1.063380
## 5 860 927 872.9479 1.877155
## 6 933 767 855.8074 1.386152
## autos_per_hh_owner autos_per_hh commuters_per_hh_renters
## 1 2.119040 2.065465 1.0114155
## 2 2.116692 2.050047 1.1812401
## 3 1.874179 1.790070 1.2321619
## 4 2.160287 1.790016 0.5774648
## 5 2.308725 2.225323 1.1896552
## 6 1.665509 1.535604 0.9560586
## commuters_per_hh_owners commuters_per_hh avg_hh_size_renters
## 1 1.2917541 1.2592102 3.10
## 2 1.1904946 1.1886851 2.37
## 3 1.1542670 1.1937399 3.62
## 4 1.2811005 1.0435816 3.21
## 5 1.3360867 1.3077884 2.97
## 6 0.9861111 0.9721362 1.86
## avg_hh_size_owners avg_hh_size area_income_renter_frac median_hh_income
## 1 2.68 2.73 0.4944563 83406
## 2 2.70 2.64 0.5907479 67775
## 3 2.49 3.06 0.5310753 29575
## 4 3.57 3.45 0.6254912 39630
## 5 2.54 2.63 0.6240961 45904
## 6 1.60 1.72 0.4573204 40250
## median_rooms_per_renter_hu median_rooms_per_owner_hu median_rooms_per_hu
## 1 5.8 7.0 6.8
## 2 4.9 6.8 6.4
## 3 4.7 5.5 5.1
## 4 5.0 6.4 5.8
## 5 6.1 6.0 6.0
## 6 4.3 5.8 5.1
## pct_hu_1_detached gross_hh_density area_income_owner_frac area_income_frac
## 1 91.82909 0.2445582 1.4957475 1.4359548
## 2 87.18984 0.1477660 1.3503202 1.1668446
## 3 66.74408 0.3250794 1.1378051 0.8183906
## 4 86.44295 0.1781333 1.3628314 1.0966296
## 5 76.35271 0.1285043 0.8042662 0.7903037
## 6 73.71695 2.8105787 1.0639247 0.6929619
## area_median_hh_income block_density avg_block_acres job_density_simple
## 1 58084 0.034159075 29.274797 0.29907016
## 2 58084 0.016443964 60.812588 0.10909054
## 3 36138 0.050349590 19.861135 0.48489988
## 4 36138 0.027383408 36.518463 0.10586369
## 5 58084 0.009473245 105.560444 0.01230987
## 6 58084 0.482062108 2.074421 1.35743121
## retail_density_simple job_gravity retail_gravity median_commute veh_count
## 1 0.016139677 9533.638 769.0001 11.98 NA
## 2 0.012723402 5505.622 672.8622 11.90 NA
## 3 0.087892490 4796.022 739.3628 23.01 NA
## 4 0.000141152 3033.812 339.6264 23.20 NA
## 5 0.000588733 2215.149 254.9094 18.17 NA
## 6 0.541232186 33531.357 2630.3615 6.71 NA
## avg_vmt avg_hh_vmt std_dev_vmt area_type area_stfid
## 1 NA NA NA cbsa 26620
## 2 NA NA NA cbsa 26620
## 3 NA NA NA county 1059
## 4 NA NA NA county 1059
## 5 NA NA NA cbsa 26620
## 6 NA NA NA cbsa 26620
## hh1_control_hh_income_frac hh1_control_hh_income hh1_control_hh_size
## 1 1 58084 4
## 2 1 58084 4
## 3 1 36138 4
## 4 1 36138 4
## 5 1 58084 4
## 6 1 58084 4
## hh1_control_hh_commuters hh1_fixes hh1_model_autos_per_hh_owners
## 1 2 0 2.50
## 2 2 0 2.55
## 3 2 0 2.42
## 4 2 0 2.50
## 5 2 0 2.62
## 6 2 0 2.09
## hh1_model_h_cost_owners hh1_model_pct_transit_commuters
## 1 1239 3.3
## 2 1206 1.3
## 3 767 0.0
## 4 757 0.0
## 5 1222 2.2
## 6 1257 7.7
## hh1_model_vmt_per_hh_owners hh1_model_autos_per_hh_renters
## 1 33491 2.15
## 2 33990 2.11
## 3 29140 1.94
## 4 31609 2.08
## 5 34085 2.18
## 6 23037 1.68
## hh1_model_h_cost_renters hh1_model_pct_transit_commute_1
## 1 1228 0.7
## 2 1153 0.0
## 3 756 0.0
## 4 771 0.0
## 5 1006 0.4
## 6 1142 7.6
## hh1_model_vmt_per_hh_renters hh1_model_autos_per_hh hh1_model_h_cost
## 1 32487 2.461694 1237.7961
## 2 32189 2.470150 1196.3817
## 3 28533 2.210655 762.2025
## 4 30384 2.379919 761.0027
## 5 34186 2.538172 1181.8301
## 6 23277 1.930378 1212.2281
## hh1_model_pct_transit_commute_2 hh1_model_vmt_per_hh hh1_alpha hh1_beta
## 1 3.015442 33381.12 11.03999 21.58926
## 2 1.064080 33663.16 11.03999 21.58926
## 3 0.000000 28875.27 11.03999 21.58926
## 4 0.000000 31258.77 11.03999 21.58926
## 5 1.865251 34103.78 11.03999 21.58926
## 6 7.661068 23130.44 11.03999 21.58926
## hh1_gas_price hh1_mpg hh1_income_bin hh1_auto_own_cost_owners
## 1 3.745 21.6 3 9740.684
## 2 3.745 21.6 3 9935.498
## 3 3.745 21.6 2 8945.705
## 4 3.745 21.6 2 9241.431
## 5 3.745 21.6 3 10208.237
## 6 3.745 21.6 3 8143.212
## hh1_vmt_cost_owners hh1_transit_cost_owners hh1_transit_trips_owners
## 1 7674.792 144.08827 72.86392
## 2 7789.143 56.76204 28.70397
## 3 6679.918 0.00000 0.00000
## 4 7245.900 0.00000 0.00000
## 5 7810.913 96.05884 48.57595
## 6 5279.155 336.20596 170.01581
## hh1_t_cost_owners hh1_t_owners hh1_h_owners hh1_ht_owners
## 1 17559.56 30.23133 25.59741 55.82874
## 2 17781.40 30.61325 24.91564 55.52889
## 3 15625.62 43.23876 25.46904 68.70779
## 4 16487.33 45.62325 25.13697 70.76023
## 5 18115.21 31.18795 25.24620 56.43415
## 6 13758.57 23.68737 25.96929 49.65666
## hh1_auto_own_cost_renters hh1_vmt_cost_renters hh1_transit_cost_renters
## 1 8376.988 7444.716 30.56418
## 2 8221.137 7376.426 0.00000
## 3 7171.350 6540.772 0.00000
## 4 7688.871 6965.086 0.00000
## 5 8493.876 7834.058 17.46524
## 6 6545.740 5334.154 331.83965
## hh1_transit_trips_renters hh1_t_cost_renters hh1_t_renters hh1_h_renters
## 1 30.22496 15852.27 27.29197 25.37015
## 2 0.00000 15597.56 26.85346 23.82067
## 3 0.00000 13712.12 37.94378 25.10377
## 4 0.00000 14653.96 40.54999 25.60186
## 5 17.27141 16345.40 28.14097 20.78369
## 6 328.15674 12211.73 21.02426 23.59342
## hh1_ht_renters hh1_auto_own_cost hh1_vmt_cost hh1_transit_cost
## 1 52.66212 9591.434 7649.612 131.66359
## 2 50.67413 9624.380 7714.244 46.46103
## 3 63.04755 8171.846 6619.231 0.00000
## 4 66.15185 8797.545 7165.613 0.00000
## 5 48.92466 9889.414 7815.218 81.44264
## 6 44.61768 7521.282 5300.567 334.50606
## hh1_transit_trips hh1_t_cost hh1_t hh1_h hh1_ht hh1_pctile_all
## 1 68.19729 17372.71 29.90963 25.57254 55.48217 37.30840
## 2 23.49485 17385.09 29.93094 24.71693 54.64787 43.81359
## 3 0.00000 14791.08 40.92943 25.30973 66.23916 55.85470
## 4 0.00000 15963.16 44.17278 25.26989 69.44266 45.11458
## 5 42.75418 17786.07 30.62130 24.41629 55.03759 59.62597
## 6 231.58338 13156.36 22.65057 25.04431 47.69488 61.42464
## hh1_pctile_own hh1_pctile_rent hh2_control_hh_income_frac
## 1 31.24179 68.40303 0.2045314
## 2 35.47754 75.13030 0.2045314
## 3 41.23002 70.03345 0.3287398
## 4 30.31855 74.47149 0.3287398
## 5 59.44543 68.49852 0.2045314
## 6 42.82633 81.96022 0.2045314
## hh2_control_hh_income hh2_control_hh_size hh2_control_hh_commuters hh2_fixes
## 1 11880 1 1 0
## 2 11880 1 1 0
## 3 11880 1 1 0
## 4 11880 1 1 0
## 5 11880 1 1 0
## 6 11880 1 1 0
## hh2_model_autos_per_hh_owners hh2_model_h_cost_owners
## 1 1.55 359
## 2 1.61 349
## 3 1.58 304
## 4 1.66 300
## 5 1.67 354
## 6 1.15 364
## hh2_model_pct_transit_commuters hh2_model_vmt_per_hh_owners
## 1 0.0 17240
## 2 0.0 18053
## 3 0.0 16819
## 4 0.0 18587
## 5 0.0 18399
## 6 4.4 9014
## hh2_model_autos_per_hh_renters hh2_model_h_cost_renters
## 1 1.23 605
## 2 1.19 568
## 3 1.14 436
## 4 1.28 444
## 5 1.26 496
## 6 0.76 562
## hh2_model_pct_transit_commute_1 hh2_model_vmt_per_hh_renters
## 1 3.8 16955
## 2 1.8 17391
## 3 0.0 16691
## 4 0.0 18201
## 5 3.4 18439
## 6 10.6 10152
## hh2_model_autos_per_hh hh2_model_h_cost hh2_model_pct_transit_commute_2
## 1 1.5149775 385.9235 0.4158921
## 2 1.5337796 388.7435 0.3266590
## 3 1.3881003 361.5699 0.0000000
## 4 1.5513557 341.1705 0.0000000
## 5 1.5937515 380.4080 0.6323046
## 6 0.9981649 441.0855 6.8137895
## hh2_model_vmt_per_hh hh2_alpha hh2_beta hh2_gas_price hh2_mpg hh2_income_bin
## 1 17208.808 11.03999 21.58926 3.745 21.6 1
## 2 17932.862 11.03999 21.58926 3.745 21.6 1
## 3 16763.175 11.03999 21.58926 3.745 21.6 1
## 4 18476.640 11.03999 21.58926 3.745 21.6 1
## 5 18406.439 11.03999 21.58926 3.745 21.6 1
## 6 9457.047 11.03999 21.58926 3.745 21.6 1
## hh2_auto_own_cost_owners hh2_vmt_cost_owners hh2_transit_cost_owners
## 1 5358.277 4047.537 0.00000
## 2 5565.695 4238.410 0.00000
## 3 5461.986 3948.696 0.00000
## 4 5738.542 4363.780 0.00000
## 5 5773.112 4319.642 0.00000
## 6 3975.496 2116.270 96.05884
## hh2_transit_trips_owners hh2_t_cost_owners hh2_t_owners hh2_h_owners
## 1 0.00000 9405.814 79.17352 36.26263
## 2 0.00000 9804.104 82.52613 35.25253
## 3 0.00000 9410.682 79.21450 30.70707
## 4 0.00000 10102.322 85.03638 30.30303
## 5 0.00000 10092.754 84.95584 35.75758
## 6 48.57595 6187.825 52.08607 36.76768
## hh2_ht_owners hh2_auto_own_cost_renters hh2_vmt_cost_renters
## 1 115.43615 4252.052 3980.626
## 2 117.77866 4113.774 4082.988
## 3 109.92157 3940.927 3918.645
## 4 115.33941 4424.900 4273.157
## 5 120.71342 4355.761 4329.033
## 6 88.85375 2627.284 2383.445
## hh2_transit_cost_renters hh2_transit_trips_renters hh2_t_cost_renters
## 1 82.95991 82.03919 8315.638
## 2 39.29680 38.86067 8236.059
## 3 0.00000 0.00000 7859.572
## 4 0.00000 0.00000 8698.057
## 5 74.22729 73.40348 8759.022
## 6 231.41449 228.84615 5242.144
## hh2_t_renters hh2_h_renters hh2_ht_renters hh2_auto_own_cost hh2_vmt_cost
## 1 69.99695 61.11111 131.1081 5237.206 4040.214
## 2 69.32710 57.37374 126.7008 5302.204 4210.204
## 3 66.15801 44.04040 110.1984 4798.598 3935.590
## 4 73.21597 44.84848 118.0645 5362.964 4337.870
## 5 73.72914 50.10101 123.8301 5509.524 4321.389
## 6 44.12579 56.76768 100.8935 3450.609 2220.287
## hh2_transit_cost hh2_transit_trips hh2_t_cost hh2_t hh2_h hh2_ht
## 1 9.079571 8.978801 9286.500 78.16919 38.98218 117.15137
## 2 7.131474 7.052325 9519.540 80.13081 39.26702 119.39783
## 3 0.000000 0.000000 8734.188 73.52010 36.52221 110.04231
## 4 0.000000 0.000000 9700.834 81.65686 34.46166 116.11852
## 5 13.804193 13.650988 9844.717 82.86799 38.42505 121.29304
## 6 148.755625 118.758903 5819.652 48.98697 44.55409 93.54106
## hh2_pctile_all hh2_pctile_own hh2_pctile_rent hh3_control_hh_income_frac
## 1 4.366817 2.361619 19.63470 0.5
## 2 7.748088 3.958269 23.34118 0.5
## 3 9.739018 4.319475 15.01427 0.5
## 4 14.449445 8.767464 25.60000 0.5
## 5 7.466889 6.382654 11.99310 0.5
## 6 13.092755 7.382407 19.66232 0.5
## hh3_control_hh_income hh3_control_hh_size hh3_control_hh_commuters hh3_fixes
## 1 29042 1 1 0
## 2 29042 1 1 0
## 3 18069 1 1 0
## 4 18069 1 1 0
## 5 29042 1 1 0
## 6 29042 1 1 0
## hh3_model_autos_per_hh_owners hh3_model_h_cost_owners
## 1 1.74 646
## 2 1.80 629
## 3 1.67 400
## 4 1.75 395
## 5 1.86 637
## 6 1.34 656
## hh3_model_pct_transit_commuters hh3_model_vmt_per_hh_owners
## 1 0 20496
## 2 0 21277
## 3 0 18090
## 4 0 19832
## 5 0 21590
## 6 4 12363
## hh3_model_autos_per_hh_renters hh3_model_h_cost_renters
## 1 1.44 812
## 2 1.40 763
## 3 1.23 500
## 4 1.37 510
## 5 1.47 666
## 6 0.97 755
## hh3_model_pct_transit_commute_1 hh3_model_vmt_per_hh_renters
## 1 1.4 20211
## 2 0.0 20615
## 3 0.0 17962
## 4 0.0 19446
## 5 1.1 21631
## 6 8.3 13502
## hh3_model_autos_per_hh hh3_model_h_cost hh3_model_pct_transit_commute_2
## 1 1.707166 664.1679 0.1532234
## 2 1.727409 653.3179 0.0000000
## 3 1.478100 443.6136 0.0000000
## 4 1.641356 427.8792 0.0000000
## 5 1.787471 642.3932 0.2045691
## 6 1.195951 694.5428 5.6740798
## hh3_model_vmt_per_hh hh3_alpha hh3_beta hh3_gas_price hh3_mpg hh3_income_bin
## 1 20464.81 11.03999 21.58926 3.745 21.6 2
## 2 21156.86 11.03999 21.58926 3.745 21.6 2
## 3 18034.17 11.03999 21.58926 3.745 21.6 1
## 4 19721.64 11.03999 21.58926 3.745 21.6 1
## 5 21597.62 11.03999 21.58926 3.745 21.6 2
## 6 12806.44 11.03999 21.58926 3.745 21.6 2
## hh3_auto_own_cost_owners hh3_vmt_cost_owners hh3_transit_cost_owners
## 1 6432.036 4698.407 0.00000
## 2 6653.830 4877.440 0.00000
## 3 5773.112 4247.097 0.00000
## 4 6049.668 4656.076 0.00000
## 5 6875.625 4949.191 0.00000
## 6 4953.407 2834.036 87.32622
## hh3_transit_trips_owners hh3_t_cost_owners hh3_t_owners hh3_h_owners
## 1 0.00000 11130.44 38.32533 26.69238
## 2 0.00000 11531.27 39.70550 25.98995
## 3 0.00000 10020.21 55.45525 26.56483
## 4 0.00000 10705.74 59.24923 26.23277
## 5 0.00000 11824.82 40.71626 26.32050
## 6 44.15995 7874.77 27.11511 27.10557
## hh3_ht_owners hh3_auto_own_cost_renters hh3_vmt_cost_renters
## 1 65.01771 5323.064 4633.075
## 2 65.69544 5175.201 4725.686
## 3 82.02008 4252.052 4217.045
## 4 85.48201 4736.026 4565.453
## 5 67.03676 5433.961 4958.589
## 6 54.22068 3585.675 3095.135
## hh3_transit_cost_renters hh3_transit_trips_renters hh3_t_cost_renters
## 1 30.56418 30.22496 9986.704
## 2 0.00000 0.00000 9900.888
## 3 0.00000 0.00000 8469.098
## 4 0.00000 0.00000 9301.479
## 5 24.01471 23.74819 10416.566
## 6 181.20191 179.19085 6862.013
## hh3_t_renters hh3_h_renters hh3_ht_renters hh3_auto_own_cost hh3_vmt_cost
## 1 34.38711 33.55141 67.93852 6310.664 4691.257
## 2 34.09162 31.52675 65.61837 6385.493 4849.900
## 3 46.87087 33.20604 80.07691 5109.724 4233.990
## 4 51.47755 33.87016 85.34771 5674.090 4630.166
## 5 35.86725 27.51877 63.38601 6607.516 4950.939
## 6 23.62789 31.19620 54.82409 4420.920 2935.688
## hh3_transit_cost hh3_transit_trips hh3_t_cost hh3_t hh3_h hh3_ht
## 1 3.345105 3.307979 11005.266 37.89431 27.44307 65.33738
## 2 0.000000 0.000000 11235.393 38.68671 26.99475 65.68146
## 3 0.000000 0.000000 9343.714 51.71129 29.46130 81.17260
## 4 0.000000 0.000000 10304.256 57.02726 28.41635 85.44361
## 5 4.466063 4.416496 11562.920 39.81448 26.54334 66.35782
## 6 123.873990 96.730302 7480.482 25.75746 28.69814 54.45560
## hh3_pctile_all hh3_pctile_own hh3_pctile_rent hh4_control_hh_income_frac
## 1 14.84982 10.95429 49.21740 1.349993
## 2 23.09875 16.92062 42.34944 1.349993
## 3 27.18101 12.22667 41.73721 1.349992
## 4 24.06475 16.16569 39.56620 1.349992
## 5 27.60486 23.98804 39.48039 1.349993
## 6 36.17303 14.73553 56.42277 1.349993
## hh4_control_hh_income hh4_control_hh_size hh4_control_hh_commuters hh4_fixes
## 1 78413 1 1 0
## 2 78413 1 1 0
## 3 48786 1 1 0
## 4 48786 1 1 0
## 5 78413 1 1 0
## 6 78413 1 1 0
## hh4_model_autos_per_hh_owners hh4_model_h_cost_owners
## 1 1.95 1243
## 2 2.01 1210
## 3 1.88 770
## 4 1.96 759
## 5 2.07 1226
## 6 1.55 1261
## hh4_model_pct_transit_commuters hh4_model_vmt_per_hh_owners
## 1 0.0 21600
## 2 0.0 22345
## 3 0.0 19219
## 4 0.0 20899
## 5 0.0 22621
## 6 3.6 13569
## hh4_model_autos_per_hh_renters hh4_model_h_cost_renters
## 1 1.67 1128
## 2 1.63 1059
## 3 1.47 695
## 4 1.61 708
## 5 1.71 924
## 6 1.21 1048
## hh4_model_pct_transit_commute_1 hh4_model_vmt_per_hh_renters
## 1 0.0 21315
## 2 0.0 21683
## 3 0.0 19090
## 4 0.0 20513
## 5 0.0 22662
## 6 5.7 14708
## hh4_model_autos_per_hh hh4_model_h_cost hh4_model_pct_transit_commute_2
## 1 1.919355 1230.4138 0.000000
## 2 1.941039 1182.5969 0.000000
## 3 1.701184 737.2898 0.000000
## 4 1.859933 744.4188 0.000000
## 5 2.003050 1169.8365 0.000000
## 6 1.417631 1178.0747 4.417574
## hh4_model_vmt_per_hh hh4_alpha hh4_beta hh4_gas_price hh4_mpg hh4_income_bin
## 1 21568.81 11.03999 21.58926 3.745 21.6 4
## 2 22224.86 11.03999 21.58926 3.745 21.6 4
## 3 19162.74 11.03999 21.58926 3.745 21.6 3
## 4 20788.64 11.03999 21.58926 3.745 21.6 3
## 5 22628.62 11.03999 21.58926 3.745 21.6 4
## 6 14012.44 11.03999 21.58926 3.745 21.6 4
## hh4_auto_own_cost_owners hh4_vmt_cost_owners hh4_transit_cost_owners
## 1 7970.763 4951.820 0.0000
## 2 8216.018 5122.612 0.0000
## 3 7324.994 4404.223 0.0000
## 4 7636.696 4789.212 0.0000
## 5 8461.272 5185.885 0.0000
## 6 6335.735 3110.706 78.5936
## hh4_transit_trips_owners hh4_t_cost_owners hh4_t_owners hh4_h_owners
## 1 0.00000 12922.583 16.48015 19.02236
## 2 0.00000 13338.629 17.01074 18.51734
## 3 0.00000 11729.217 24.04218 18.93986
## 4 0.00000 12425.908 25.47023 18.66929
## 5 0.00000 13647.157 17.40420 18.76220
## 6 39.74396 9525.034 12.14726 19.29782
## hh4_ht_owners hh4_auto_own_cost_renters hh4_vmt_cost_renters
## 1 35.50251 6826.243 4886.483
## 2 35.52807 6662.741 4970.848
## 3 42.98204 5727.522 4374.661
## 4 44.13952 6273.000 4700.756
## 5 36.16640 6989.746 5195.284
## 6 31.44508 4945.961 3371.823
## hh4_transit_cost_renters hh4_transit_trips_renters hh4_t_cost_renters
## 1 0.0000 0.0000 11712.727
## 2 0.0000 0.0000 11633.588
## 3 0.0000 0.0000 10102.184
## 4 0.0000 0.0000 10973.756
## 5 0.0000 0.0000 12185.031
## 6 124.4399 123.0588 8442.223
## hh4_t_renters hh4_h_renters hh4_ht_renters hh4_auto_own_cost hh4_vmt_cost
## 1 14.93723 17.26244 32.19967 7845.501 4944.669
## 2 14.83630 16.20650 31.04280 7934.133 5095.070
## 3 20.70714 17.09507 37.80220 6628.280 4391.330
## 4 22.49366 17.41483 39.90849 7246.807 4763.922
## 5 15.53955 14.14051 29.68007 8187.609 5187.633
## 6 10.76636 16.03816 26.80451 5794.667 3212.364
## hh4_transit_cost hh4_transit_trips hh4_t_cost hh4_t hh4_h hh4_ht
## 1 0.00000 0.00000 12790.170 16.31129 18.82974 35.14103
## 2 0.00000 0.00000 13029.203 16.61613 18.09797 34.71410
## 3 0.00000 0.00000 11019.610 22.58765 18.13528 40.72293
## 4 0.00000 0.00000 12010.729 24.61921 18.31063 42.92985
## 5 0.00000 0.00000 13375.242 17.05743 17.90269 34.96012
## 6 96.44251 72.18016 9103.473 11.60965 18.02877 29.63841
## hh4_pctile_all hh4_pctile_own hh4_pctile_rent hh5_control_hh_income_frac
## 1 48.58739 44.13949 82.45440 0.7999966
## 2 56.68512 49.21008 87.44093 0.7999966
## 3 69.97239 61.71037 76.67848 0.7999889
## 4 62.13566 52.20544 85.55581 0.7999889
## 5 77.76084 75.42029 87.53165 0.7999966
## 6 74.17556 62.82828 87.23023 0.7999966
## hh5_control_hh_income hh5_control_hh_size hh5_control_hh_commuters hh5_fixes
## 1 46467 2 0 0
## 2 46467 2 0 0
## 3 28910 2 0 0
## 4 28910 2 0 0
## 5 46467 2 0 0
## 6 46467 2 0 0
## hh5_model_autos_per_hh_owners hh5_model_h_cost_owners
## 1 1.63 1341
## 2 1.68 1306
## 3 1.55 831
## 4 1.63 820
## 5 1.75 1323
## 6 1.22 1361
## hh5_model_pct_transit_commuters hh5_model_vmt_per_hh_owners
## 1 2.3 15415
## 2 0.2 15900
## 3 0.0 14550
## 4 0.0 15360
## 5 1.2 15666
## 6 6.7 10393
## hh5_model_autos_per_hh_renters hh5_model_h_cost_renters
## 1 1.21 1090
## 2 1.17 1023
## 3 1.01 671
## 4 1.15 684
## 5 1.25 893
## 6 0.75 1013
## hh5_model_pct_transit_commute_1 hh5_model_vmt_per_hh_renters
## 1 3.1 15849
## 2 1.2 16377
## 3 0.0 14901
## 4 0.0 15813
## 5 2.8 15647
## 6 10.0 12430
## hh5_model_autos_per_hh hh5_model_h_cost hh5_model_pct_transit_commute_2
## 1 1.584033 1313.5292 2.3875562
## 2 1.587447 1254.6419 0.3814772
## 3 1.314487 761.2183 0.0000000
## 4 1.492765 781.1168 0.0000000
## 5 1.657014 1243.0321 1.4975551
## 6 1.037019 1225.5163 7.9847589
## hh5_model_vmt_per_hh hh5_alpha hh5_beta hh5_gas_price hh5_mpg hh5_income_bin
## 1 15462.50 11.03999 21.58926 3.745 21.6 3
## 2 15986.56 11.03999 21.58926 3.745 21.6 3
## 3 14703.08 11.03999 21.58926 3.745 21.6 2
## 4 15489.52 11.03999 21.58926 3.745 21.6 2
## 5 15662.47 11.03999 21.58926 3.745 21.6 3
## 6 11186.05 11.03999 21.58926 3.745 21.6 3
## hh5_auto_own_cost_owners hh5_vmt_cost_owners hh5_transit_cost_owners
## 1 6350.926 3532.499 0
## 2 6545.740 3643.642 0
## 3 5729.687 3335.374 0
## 4 6025.413 3521.055 0
## 5 6818.479 3590.018 0
## 6 4753.454 2381.658 0
## hh5_transit_trips_owners hh5_t_cost_owners hh5_t_owners hh5_h_owners
## 1 0 9883.425 21.26977 34.63103
## 2 0 10189.381 21.92821 33.72716
## 3 0 9065.061 31.35614 34.49325
## 4 0 9546.468 33.02133 34.03667
## 5 0 10408.497 22.39976 34.16618
## 6 0 7135.112 15.35522 35.14752
## hh5_ht_owners hh5_auto_own_cost_renters hh5_vmt_cost_renters
## 1 55.90080 4714.491 3631.954
## 2 55.65537 4558.640 3752.951
## 3 65.84940 3733.538 3415.836
## 4 67.05800 4251.058 3624.898
## 5 56.56594 4870.342 3585.664
## 6 50.50275 2922.205 2848.457
## hh5_transit_cost_renters hh5_transit_trips_renters hh5_t_cost_renters
## 1 0 0 8346.445
## 2 0 0 8311.591
## 3 0 0 7149.374
## 4 0 0 7875.957
## 5 0 0 8456.006
## 6 0 0 5770.662
## hh5_t_renters hh5_h_renters hh5_ht_renters hh5_auto_own_cost hh5_vmt_cost
## 1 17.96209 28.14901 46.11110 6171.826 3543.384
## 2 17.88708 26.41875 44.30583 6185.126 3663.479
## 3 24.72976 27.85195 52.58171 4859.095 3370.466
## 4 27.24302 28.39156 55.63458 5518.114 3550.744
## 5 18.19787 23.06153 41.25940 6456.180 3589.208
## 6 12.41884 26.16050 38.57934 4040.510 2563.393
## hh5_transit_cost hh5_transit_trips hh5_t_cost hh5_t hh5_h hh5_ht
## 1 0 0 9715.210 20.90776 33.92160 54.82936
## 2 0 0 9848.605 21.19484 32.40085 53.59569
## 3 0 0 8229.562 28.46614 31.59675 60.06289
## 4 0 0 9068.858 31.36928 32.42270 63.79197
## 5 0 0 10045.388 21.61833 32.10103 53.71936
## 6 0 0 6603.903 14.21203 31.64869 45.86072
## hh5_pctile_all hh5_pctile_own hh5_pctile_rent hh6_control_hh_income_frac
## 1 28.10589 23.81086 61.07781 0.5
## 2 37.38392 27.70036 65.09421 0.5
## 3 48.24339 28.79311 60.67998 0.5
## 4 39.75040 24.48840 65.75446 0.5
## 5 49.58031 47.17195 56.79152 0.5
## 6 53.23034 30.79044 77.63537 0.5
## hh6_control_hh_income hh6_control_hh_size hh6_control_hh_commuters hh6_fixes
## 1 29042 3 1 0
## 2 29042 3 1 0
## 3 18069 3 1 0
## 4 18069 3 1 0
## 5 29042 3 1 0
## 6 29042 3 1 0
## hh6_model_autos_per_hh_owners hh6_model_h_cost_owners
## 1 1.94 879
## 2 1.99 856
## 3 1.87 545
## 4 1.94 537
## 5 2.06 867
## 6 1.53 892
## hh6_model_pct_transit_commuters hh6_model_vmt_per_hh_owners
## 1 3.1 23448
## 2 1.0 23960
## 3 0.0 20825
## 4 0.0 22500
## 5 1.9 23912
## 6 7.5 15649
## hh6_model_autos_per_hh_renters hh6_model_h_cost_renters
## 1 1.54 955
## 2 1.50 897
## 3 1.34 588
## 4 1.48 599
## 5 1.58 782
## 6 1.08 887
## hh6_model_pct_transit_commute_1 hh6_model_vmt_per_hh_renters
## 1 3.5 23162
## 2 1.5 23299
## 3 0.0 20697
## 4 0.0 22115
## 5 3.1 23953
## 6 10.3 16788
## hh6_model_autos_per_hh hh6_model_h_cost hh6_model_pct_transit_commute_2
## 1 1.896222 887.3178 3.143778
## 2 1.901076 863.4406 1.090739
## 3 1.638848 563.7538 0.000000
## 4 1.808483 554.7262 0.000000
## 5 1.970733 851.1924 2.123166
## 6 1.354806 890.0534 8.590098
## hh6_model_vmt_per_hh hh6_alpha hh6_beta hh6_gas_price hh6_mpg hh6_income_bin
## 1 23416.70 11.03999 21.58926 3.745 21.6 2
## 2 23840.04 11.03999 21.58926 3.745 21.6 2
## 3 20769.17 11.03999 21.58926 3.745 21.6 1
## 4 22389.93 11.03999 21.58926 3.745 21.6 1
## 5 23919.62 11.03999 21.58926 3.745 21.6 2
## 6 16092.44 11.03999 21.58926 3.745 21.6 2
## hh6_auto_own_cost_owners hh6_vmt_cost_owners hh6_transit_cost_owners
## 1 7171.350 5375.110 67.67782
## 2 7356.179 5492.479 21.83156
## 3 6464.502 4889.209 0.00000
## 4 6706.489 5282.458 0.00000
## 5 7614.939 5481.475 41.47996
## 6 5655.756 3587.304 163.73667
## hh6_transit_trips_owners hh6_t_cost_owners hh6_t_owners hh6_h_owners
## 1 34.22396 12614.138 43.43412 36.31981
## 2 11.03999 12870.489 44.31681 35.36946
## 3 0.00000 11353.711 62.83530 36.19459
## 4 0.00000 11988.948 66.35092 35.66329
## 5 20.97598 13137.894 45.23757 35.82398
## 6 82.79991 9406.796 32.39032 36.85697
## hh6_ht_owners hh6_auto_own_cost_renters hh6_vmt_cost_renters
## 1 79.75394 5692.721 5309.549
## 2 79.68628 5544.859 5340.954
## 3 99.02989 4632.317 4859.157
## 4 102.01421 5116.291 5192.070
## 5 81.06155 5840.584 5490.874
## 6 69.24728 3992.298 3848.403
## hh6_transit_cost_renters hh6_transit_trips_renters hh6_t_cost_renters
## 1 76.41044 75.56241 11078.681
## 2 32.74733 32.38389 10918.560
## 3 0.00000 0.00000 9491.475
## 4 0.00000 0.00000 10308.360
## 5 67.67782 66.92670 11399.136
## 6 224.86502 222.36937 8065.566
## hh6_t_renters hh6_h_renters hh6_ht_renters hh6_auto_own_cost hh6_vmt_cost
## 1 38.14710 39.46009 77.60719 7009.521 5367.935
## 2 37.59576 37.06356 74.65932 7027.466 5464.980
## 3 52.52905 39.05031 91.57936 5665.421 4876.102
## 4 57.04998 39.78084 96.83082 6251.842 5256.616
## 5 39.25052 32.31182 71.56234 7284.959 5483.223
## 6 27.77207 36.65037 64.42244 5008.137 3688.955
## hh6_transit_cost hh6_transit_trips hh6_t_cost hh6_t hh6_h hh6_ht
## 1 68.63357 38.74826 12446.090 42.85548 36.66350 79.51899
## 2 23.81252 14.91342 12516.258 43.09710 35.67691 78.77400
## 3 0.00000 0.00000 10541.523 58.34038 37.44007 95.78045
## 4 0.00000 0.00000 11508.458 63.69172 36.84052 100.53225
## 5 46.35202 29.52152 12814.534 44.12414 35.17082 79.29496
## 6 187.53521 137.13722 8884.627 30.59234 36.77653 67.36887
## hh6_pctile_all hh6_pctile_own hh6_pctile_rent hh7_control_hh_income_frac
## 1 14.84982 10.95429 49.21740 0.7999966
## 2 23.09875 16.92062 42.34944 0.7999966
## 3 27.18101 12.22667 41.73721 0.7999889
## 4 24.06475 16.16569 39.56620 0.7999889
## 5 27.60486 23.98804 39.48039 0.7999966
## 6 36.17303 14.73553 56.42277 0.7999966
## hh7_control_hh_income hh7_control_hh_size hh7_control_hh_commuters hh7_fixes
## 1 46467 3 1 0
## 2 46467 3 1 0
## 3 28910 3 1 0
## 4 28910 3 1 0
## 5 46467 3 1 0
## 6 46467 3 1 0
## hh7_model_autos_per_hh_owners hh7_model_h_cost_owners
## 1 2.04 1198
## 2 2.09 1166
## 3 1.97 742
## 4 2.04 732
## 5 2.16 1182
## 6 1.63 1215
## hh7_model_pct_transit_commuters hh7_model_vmt_per_hh_owners
## 1 2.9 24300
## 2 0.8 24795
## 3 0.0 21689
## 4 0.0 23335
## 5 1.7 24730
## 6 7.3 16550
## hh7_model_autos_per_hh_renters hh7_model_h_cost_renters
## 1 1.65 1115
## 2 1.61 1047
## 3 1.45 687
## 4 1.59 700
## 5 1.69 914
## 6 1.19 1036
## hh7_model_pct_transit_commute_1 hh7_model_vmt_per_hh_renters
## 1 2.2 24015
## 2 0.3 24134
## 3 0.0 21561
## 4 0.0 22949
## 5 1.9 24771
## 6 9.1 17688
## hh7_model_autos_per_hh hh7_model_h_cost hh7_model_pct_transit_commute_2
## 1 1.997316 1188.9160 2.8233883
## 2 2.002891 1144.4042 0.7092614
## 3 1.743209 718.0125 0.0000000
## 4 1.911342 722.8510 0.0000000
## 5 2.072593 1132.1595 1.7371944
## 6 1.458699 1145.3116 8.0007776
## hh7_model_vmt_per_hh hh7_alpha hh7_beta hh7_gas_price hh7_mpg hh7_income_bin
## 1 24268.81 11.03999 21.58926 3.745 21.6 3
## 2 24675.04 11.03999 21.58926 3.745 21.6 3
## 3 21633.17 11.03999 21.58926 3.745 21.6 2
## 4 23224.64 11.03999 21.58926 3.745 21.6 2
## 5 24737.62 11.03999 21.58926 3.745 21.6 3
## 6 16993.05 11.03999 21.58926 3.745 21.6 3
## hh7_auto_own_cost_owners hh7_vmt_cost_owners hh7_transit_cost_owners
## 1 7948.398 5568.584 63.31151
## 2 8143.212 5682.018 17.46524
## 3 7282.248 4971.885 0.00000
## 4 7541.008 5349.206 0.00000
## 5 8415.951 5667.123 37.11364
## 6 6350.926 3792.595 159.37036
## hh7_transit_trips_owners hh7_t_cost_owners hh7_t_owners hh7_h_owners
## 1 32.01596 13580.29 29.22567 30.93809
## 2 8.83199 13842.70 29.79038 30.11169
## 3 0.00000 12254.13 42.38718 30.79903
## 4 0.00000 12890.21 44.58739 30.38395
## 5 18.76798 14120.19 30.38756 30.52489
## 6 80.59191 10302.89 22.17249 31.37711
## hh7_ht_owners hh7_auto_own_cost_renters hh7_vmt_cost_renters
## 1 60.16376 6428.851 5503.274
## 2 59.90207 6273.000 5530.544
## 3 73.18621 5360.030 4942.543
## 4 74.97134 5877.550 5260.722
## 5 60.91245 6584.702 5676.519
## 6 53.54960 4636.566 4053.379
## hh7_transit_cost_renters hh7_transit_trips_renters hh7_t_cost_renters
## 1 48.029422 47.496371 11980.154
## 2 6.549467 6.476778 11810.094
## 3 0.000000 0.000000 10302.573
## 4 0.000000 0.000000 11138.272
## 5 41.479956 41.019593 12302.701
## 6 198.667157 196.462261 8888.612
## hh7_t_renters hh7_h_renters hh7_ht_renters hh7_auto_own_cost hh7_vmt_cost
## 1 25.78207 28.79463 54.57670 7782.091 5561.436
## 2 25.41609 27.03854 52.45463 7803.811 5654.529
## 3 35.63671 28.51608 64.15279 6443.900 4959.088
## 4 38.52740 29.05569 67.58309 7065.415 5323.908
## 5 26.47621 23.60385 50.08006 8075.390 5668.870
## 6 19.12887 26.75447 45.88334 5683.490 3894.124
## hh7_transit_cost hh7_transit_trips hh7_t_cost hh7_t hh7_h hh7_ht
## 1 61.63896 33.710222 13405.166 28.84879 30.70349 59.55228
## 2 15.48428 8.404573 13473.824 28.99654 29.55399 58.55053
## 3 0.00000 0.000000 11402.988 39.44306 29.80336 69.24641
## 4 0.00000 0.000000 12389.323 42.85480 30.00419 72.85899
## 5 37.92566 22.906155 13782.186 29.66016 29.23777 58.89793
## 6 174.66942 125.702658 9752.283 20.98755 29.57742 50.56496
## hh7_pctile_all hh7_pctile_own hh7_pctile_rent hh8_control_hh_income_frac
## 1 28.10589 23.81086 61.07781 1.5
## 2 37.38392 27.70036 65.09421 1.5
## 3 48.24339 28.79311 60.67998 1.5
## 4 39.75040 24.48840 65.75446 1.5
## 5 49.58031 47.17195 56.79152 1.5
## 6 53.23034 30.79044 77.63537 1.5
## hh8_control_hh_income hh8_control_hh_size hh8_control_hh_commuters hh8_fixes
## 1 87126 4 2 0
## 2 87126 4 2 0
## 3 54207 4 2 0
## 4 54207 4 2 0
## 5 87126 4 2 0
## 6 87126 4 2 0
## hh8_model_autos_per_hh_owners hh8_model_h_cost_owners
## 1 2.58 1618
## 2 2.64 1575
## 3 2.51 1002
## 4 2.59 989
## 5 2.71 1596
## 6 2.18 1642
## hh8_model_pct_transit_commuters hh8_model_vmt_per_hh_owners
## 1 3.2 33707
## 2 1.1 34190
## 3 0.0 29366
## 4 0.0 31809
## 5 2.0 34271
## 6 7.5 23294
## hh8_model_autos_per_hh_renters hh8_model_h_cost_renters
## 1 2.24 1404
## 2 2.20 1319
## 3 2.04 865
## 4 2.18 881
## 5 2.28 1151
## 6 1.78 1305
## hh8_model_pct_transit_commute_1 hh8_model_vmt_per_hh_renters
## 1 0.0 32702
## 2 0.0 32390
## 3 0.0 28758
## 4 0.0 30584
## 5 0.0 34371
## 6 6.5 23534
## hh8_model_autos_per_hh hh8_model_h_cost hh8_model_pct_transit_commute_2
## 1 2.542789 1594.5787 2.8497751
## 2 2.560150 1528.5418 0.9003751
## 3 2.305016 942.2494 0.0000000
## 4 2.472779 958.1221 0.0000000
## 5 2.630032 1513.2425 1.6280561
## 6 2.024272 1510.7989 7.1106791
## hh8_model_vmt_per_hh hh8_alpha hh8_beta hh8_gas_price hh8_mpg hh8_income_bin
## 1 33597.01 11.03999 21.58926 3.745 21.6 4
## 2 33863.34 11.03999 21.58926 3.745 21.6 4
## 3 29100.83 11.03999 21.58926 3.745 21.6 3
## 4 31458.77 11.03999 21.58926 3.745 21.6 3
## 5 34289.60 11.03999 21.58926 3.745 21.6 4
## 6 23387.44 11.03999 21.58926 3.745 21.6 4
## hh8_auto_own_cost_owners hh8_vmt_cost_owners hh8_transit_cost_owners
## 1 10545.933 7727.361 139.72196
## 2 10791.187 7838.089 48.02942
## 3 9779.647 6729.508 0.00000
## 4 10091.349 7289.346 0.00000
## 5 11077.317 7856.658 87.32622
## 6 8910.905 5340.171 327.47334
## hh8_transit_trips_owners hh8_t_cost_owners hh8_t_owners hh8_h_owners
## 1 70.65592 18413.02 21.13378 22.28497
## 2 24.28797 18677.31 21.43712 21.69272
## 3 0.00000 16509.15 30.45576 22.18164
## 4 0.00000 17380.69 32.06356 21.89385
## 5 44.15995 19021.30 21.83195 21.98196
## 6 165.59982 14578.55 16.73272 22.61552
## hh8_ht_owners hh8_auto_own_cost_renters hh8_vmt_cost_renters
## 1 43.41874 9156.159 7496.964
## 2 43.12984 8992.656 7425.437
## 3 52.63740 7948.398 6590.179
## 4 53.95741 8493.876 7008.625
## 5 43.81390 9319.662 7879.583
## 6 39.34824 7275.876 5395.191
## hh8_transit_cost_renters hh8_transit_trips_renters hh8_t_cost_renters
## 1 0.0000 0.0000 16653.12
## 2 0.0000 0.0000 16418.09
## 3 0.0000 0.0000 14538.58
## 4 0.0000 0.0000 15502.50
## 5 0.0000 0.0000 17199.25
## 6 283.8102 280.6604 12954.88
## hh8_t_renters hh8_h_renters hh8_ht_renters hh8_auto_own_cost hh8_vmt_cost
## 1 19.11384 19.33751 38.45135 10393.829 7702.145
## 2 18.84408 18.16679 37.01087 10464.795 7763.202
## 3 26.82048 19.14882 45.96930 8980.974 6668.742
## 4 28.59871 19.50302 48.10172 9634.622 7209.086
## 5 19.74066 15.85290 35.59356 10750.443 7860.922
## 6 14.86913 17.97397 32.84310 8274.354 5361.592
## hh8_transit_cost hh8_transit_trips hh8_t_cost hh8_t hh8_h hh8_ht
## 1 124.43005 62.92296 18220.40 20.91271 21.96238 42.87509
## 2 39.31318 19.88026 18267.31 20.96654 21.05285 42.01939
## 3 0.00000 0.00000 15649.72 28.87029 20.85892 49.72920
## 4 0.00000 0.00000 16843.71 31.07294 21.21030 52.28323
## 5 71.08600 35.94744 18682.45 21.44303 20.84212 42.28515
## 6 310.47437 210.39529 13946.42 16.00718 20.80847 36.81565
## hh8_pctile_all hh8_pctile_own hh8_pctile_rent SHAPE_Length SHAPE_Area
## 1 55.16429 50.65007 89.53620 0.55584745 0.0061885567
## 2 60.85609 54.09851 88.65992 0.43655247 0.0087120733
## 3 73.28998 67.39525 79.80734 0.25988543 0.0022682098
## 4 66.68073 56.11785 87.09375 0.24588258 0.0028389148
## 5 81.27362 78.56902 92.56416 0.45202763 0.0074731481
## 6 77.80104 67.50748 89.64342 0.06940131 0.0002283185
# confine columns to those we're using
df1 <- df_csv[c(1:11, 15:21, 26:31)]
head(df1)
## OBJECTID GEOID STATE COUNTY TRACT CNTY_FIPS STUSAB households
## 1 1 1089010800 1 89 10800 1089 AL 3773
## 2 2 1089010701 1 89 10701 1089 AL 3217
## 3 3 1059973000 1 59 973000 1059 AL 1853
## 4 4 1059973200 1 59 973200 1059 AL 1262
## 5 5 1089010401 1 89 10401 1089 AL 2401
## 6 6 1089001000 1 89 1000 1089 AL 1615
## owner_occupied_hu renter_occupied_hu pct_renters pct_transit_j2w
## 1 3335 438 10.94453 0
## 2 2588 629 18.14772 0
## 3 914 939 43.61356 0
## 4 836 426 28.59060 0
## 5 1937 464 18.59719 0
## 6 864 751 38.93209 0
## median_smoc_mortgage median_gross_rent avg_h_cost autos_per_hh_renters
## 1 1237 879 1195.4405 1.657534
## 2 1258 738 1156.3276 1.775835
## 3 737 622 678.7242 1.708200
## 4 834 533 732.3946 1.063380
## 5 860 927 872.9479 1.877155
## 6 933 767 855.8074 1.386152
## autos_per_hh_owner autos_per_hh avg_hh_size_owners avg_hh_size
## 1 2.119040 2.065465 2.68 2.73
## 2 2.116692 2.050047 2.70 2.64
## 3 1.874179 1.790070 2.49 3.06
## 4 2.160287 1.790016 3.57 3.45
## 5 2.308725 2.225323 2.54 2.63
## 6 1.665509 1.535604 1.60 1.72
## area_income_renter_frac median_hh_income median_rooms_per_renter_hu
## 1 0.4944563 83406 5.8
## 2 0.5907479 67775 4.9
## 3 0.5310753 29575 4.7
## 4 0.6254912 39630 5.0
## 5 0.6240961 45904 6.1
## 6 0.4573204 40250 4.3
## median_rooms_per_owner_hu
## 1 7.0
## 2 6.8
## 3 5.5
## 4 6.4
## 5 6.0
## 6 5.8
# double-check all states are present
unique(df1[c("STUSAB")])
## STUSAB
## 1 AL
## 653 AK
## 680 AZ
## 980
## 1764 AR
## 2840 CA
## 11315 CO
## 11911 CT
## 13314 FL
## 13334 DE
## 14019 DC
## 17707 GA
## 19555 HI
## 19800 IL
## 20472 ID
## 23402 IN
## 24699 KS
## 24951 IA
## 26279 KY
## 27631 LA
## 28800 MD
## 28809 ME
## 30869 MA
## 31846 MI
## 34798 MN
## 36090 MS
## 37037 MO
## 38404 NE
## 38407 NV
## 38955 MT
## 39533 NH
## 40284 NJ
## 41640 NM
## 42387 NY
## 44531 NC
## 44561 ND
## 44613 OH
## 50506 PA
## 50627 OR
## 53876 OK
## 55771 TN
## 55803 SD
## 55852 SC
## 59593 RI
## 60365 TX
## 66083 WA
## 66234 WV
## 66361 WI
## 66945 VA
## 68124 UT
## 68130 VT
## 71865 WY
## 71896 PR
# let's work with only Idaho entries for now
idaho_df <- df1[ which(df1$STUSAB=='ID'), ]
summary(idaho_df)
## OBJECTID GEOID STATE COUNTY
## Min. :20472 Min. :1.600e+10 Min. :16 Min. : 1.00
## 1st Qu.:20600 1st Qu.:1.601e+10 1st Qu.:16 1st Qu.: 5.00
## Median :20720 Median :1.603e+10 Median :16 Median :27.00
## Mean :20764 Mean :1.603e+10 Mean :16 Mean :33.13
## 3rd Qu.:20871 3rd Qu.:1.606e+10 3rd Qu.:16 3rd Qu.:55.00
## Max. :21629 Max. :1.609e+10 Max. :16 Max. :87.00
##
## TRACT CNTY_FIPS STUSAB households
## Min. : 100 Min. :16001 Length:298 Min. : 20
## 1st Qu.: 1627 1st Qu.:16005 Class :character 1st Qu.:1303
## Median : 22002 Median :16027 Mode :character Median :1754
## Mean :470301 Mean :16033 Mean :2000
## 3rd Qu.:960200 3rd Qu.:16055 3rd Qu.:2444
## Max. :981800 Max. :16087 Max. :7974
##
## owner_occupied_hu renter_occupied_hu pct_renters pct_transit_j2w
## Min. : 0.0 Min. : 3.0 Min. : 0.505 Min. :0.0000
## 1st Qu.: 827.8 1st Qu.: 302.2 1st Qu.:16.180 1st Qu.:0.0000
## Median :1228.0 Median : 517.0 Median :25.506 Median :0.2950
## Mean :1377.6 Mean : 622.7 Mean :27.346 Mean :0.7372
## 3rd Qu.:1669.2 3rd Qu.: 800.2 3rd Qu.:34.322 3rd Qu.:1.0026
## Max. :6965.0 Max. :3017.0 Max. :80.894 Max. :6.8351
## NA's :2
## median_smoc_mortgage median_gross_rent avg_h_cost autos_per_hh_renters
## Min. : 662.0 Min. : 375.0 Min. : 526.6 Min. :0.9869
## 1st Qu.: 997.8 1st Qu.: 645.0 1st Qu.: 894.4 1st Qu.:1.4268
## Median :1124.0 Median : 720.0 Median :1000.5 Median :1.6345
## Mean :1173.1 Mean : 772.9 Mean :1050.3 Mean :1.6619
## 3rd Qu.:1265.8 3rd Qu.: 869.0 3rd Qu.:1168.5 3rd Qu.:1.8754
## Max. :2470.0 Max. :1694.0 Max. :1911.1 Max. :2.6466
## NA's :2 NA's :3 NA's :4 NA's :2
## autos_per_hh_owner autos_per_hh avg_hh_size_owners avg_hh_size
## Min. :1.292 Min. :1.066 Min. :1.240 Min. :1.20
## 1st Qu.:2.095 1st Qu.:1.872 1st Qu.:2.400 1st Qu.:2.40
## Median :2.269 Median :2.101 Median :2.660 Median :2.65
## Mean :2.257 Mean :2.067 Mean :2.666 Mean :2.67
## 3rd Qu.:2.427 3rd Qu.:2.287 3rd Qu.:2.900 3rd Qu.:2.92
## Max. :3.021 Max. :2.862 Max. :4.390 Max. :5.54
## NA's :2 NA's :1
## area_income_renter_frac median_hh_income median_rooms_per_renter_hu
## Min. :0.2912 Min. : 17469 Min. :3.000
## 1st Qu.:0.5315 1st Qu.: 39670 1st Qu.:4.300
## Median :0.6748 Median : 47396 Median :4.700
## Mean :0.7072 Mean : 49565 Mean :4.727
## 3rd Qu.:0.8087 3rd Qu.: 57772 3rd Qu.:5.100
## Max. :3.4207 Max. :129625 Max. :7.800
##
## median_rooms_per_owner_hu
## Min. :4.500
## 1st Qu.:6.000
## Median :6.400
## Mean :6.531
## 3rd Qu.:7.100
## Max. :9.000
##
ggplot(idaho_df, aes(avg_h_cost, pct_renters)) +
geom_point() +
geom_point(colour = '#6495ED') +
stat_smooth(method = "lm", col = "#247B45") +
labs(x = "Average House Cost per Month", y = "Percent Renters",
title = "Average House Cost per Month to Percent Renters in Idaho")
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).
## Warning: Removed 4 rows containing missing values (geom_point).
## Warning: Removed 4 rows containing missing values (geom_point).

# This kind of follows what is expected; the highter the house cost, the less
# likely one is to rent it; if you're spending that much money, might as well
# be to buy.
ir1 <- lm(idaho_df$pct_renters ~ idaho_df$avg_h_cost)
ir1
##
## Call:
## lm(formula = idaho_df$pct_renters ~ idaho_df$avg_h_cost)
##
## Coefficients:
## (Intercept) idaho_df$avg_h_cost
## 63.89955 -0.03477
summary(ir1)
##
## Call:
## lm(formula = idaho_df$pct_renters ~ idaho_df$avg_h_cost)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.189 -8.206 -1.649 5.966 37.234
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 63.899546 3.194541 20.00 <2e-16 ***
## idaho_df$avg_h_cost -0.034772 0.002967 -11.72 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.03 on 292 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.3199, Adjusted R-squared: 0.3175
## F-statistic: 137.3 on 1 and 292 DF, p-value: < 2.2e-16
# This shows that the findings are actually significant, as the Pr(>|t|) is
# close to 0. However, the r-squared value is very low, meaning that there are
# other variables we could use to strenghten the significance. This makes sense,
# as adding income to this would probably account for some variance.
ggplot(idaho_df, aes(median_hh_income, pct_renters)) +
geom_point() +
geom_point(colour = '#6495ED') +
stat_smooth(method = "lm", col = "#247B45") +
labs(x = "Median Household Income", y = "Percent Renters",
title = "Median Household Income to Percent Renters in Idaho")
## `geom_smooth()` using formula 'y ~ x'

ir2 <- lm(data = idaho_df, pct_renters ~ median_hh_income)
summary(ir2)
##
## Call:
## lm(formula = pct_renters ~ median_hh_income, data = idaho_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.630 -8.419 -1.013 7.039 48.570
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.385e+01 2.373e+00 22.69 <2e-16 ***
## median_hh_income -5.348e-04 4.564e-05 -11.72 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.38 on 296 degrees of freedom
## Multiple R-squared: 0.3169, Adjusted R-squared: 0.3146
## F-statistic: 137.3 on 1 and 296 DF, p-value: < 2.2e-16
# The higher your income, the higher likelihood that you have the money to
# own your own home. The p-value shows this is also significant: close to 0.
# 2.2e-16.
ir3 <- lm(data = idaho_df, pct_renters ~ median_hh_income + avg_h_cost)
summary(ir3)
##
## Call:
## lm(formula = pct_renters ~ median_hh_income + avg_h_cost, data = idaho_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.078 -7.966 -1.497 5.789 35.897
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.108e+01 3.213e+00 19.007 < 2e-16 ***
## median_hh_income -3.072e-04 8.153e-05 -3.768 0.000199 ***
## avg_h_cost -1.759e-02 5.406e-03 -3.253 0.001277 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.77 on 291 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.3515, Adjusted R-squared: 0.347
## F-statistic: 78.87 on 2 and 291 DF, p-value: < 2.2e-16
# Just for the sake of it, I included a regression analysis using both variables,
# median household income passes the most stringent of significance tests while
# average house cost is slightly less so, though still significant. The r-squared
# is still a bit low, but this could also be explained by geography--where a
# higher percentage of homes are purely up for rent.
ggplot(idaho_df, aes(households, median_gross_rent)) +
geom_point() +
geom_point(colour = '#6495ED') +
stat_smooth(method = "lm", col = "#247B45") +
labs(x = "Quantity of Households in Region", y = "Median Gross Rent",
title = "Quantity of Households in Region to Median Gross Rent in Idaho")
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (stat_smooth).
## Warning: Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values (geom_point).

# The logic: the more people want to live there, the more households there are,
# the higher the rent. The p-value shows that households are still significant
# to the predicting number of households, but understandably, the r-squared is
# still terribly low.
ir4 <- lm(data = idaho_df, median_gross_rent ~ households)
summary(ir4)
##
## Call:
## lm(formula = median_gross_rent ~ households, data = idaho_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -313.13 -112.97 -36.27 70.61 945.05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.382e+02 2.117e+01 30.147 < 2e-16 ***
## households 6.673e-02 9.149e-03 7.294 2.83e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 177.7 on 293 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.1537, Adjusted R-squared: 0.1508
## F-statistic: 53.2 on 1 and 293 DF, p-value: 2.829e-12
# california analysis
cali_df <- df1[ which(df1$STUSAB=='CA'), ]
summary(cali_df)
## OBJECTID GEOID STATE COUNTY
## Min. : 2840 Min. :6.001e+09 Min. :6 Min. : 1.0
## 1st Qu.: 5570 1st Qu.:6.037e+09 1st Qu.:6 1st Qu.: 37.0
## Median : 7582 Median :6.059e+09 Median :6 Median : 59.0
## Mean : 7568 Mean :6.055e+09 Mean :6 Mean : 54.7
## 3rd Qu.: 9592 3rd Qu.:6.073e+09 3rd Qu.:6 3rd Qu.: 73.0
## Max. :12659 Max. :6.115e+09 Max. :6 Max. :115.0
##
## TRACT CNTY_FIPS STUSAB households
## Min. : 100 Min. :6001 Length:8042 Min. : 4
## 1st Qu.: 9112 1st Qu.:6037 Class :character 1st Qu.:1137
## Median : 86406 Median :6059 Mode :character Median :1509
## Mean :205105 Mean :6055 Mean :1605
## 3rd Qu.:406375 3rd Qu.:6073 3rd Qu.:1979
## Max. :990100 Max. :6115 Max. :8542
## NA's :62
## owner_occupied_hu renter_occupied_hu pct_renters pct_transit_j2w
## Min. : 0.0 Min. : 0.0 Min. : 0.00 Min. : 0.0000
## 1st Qu.: 473.0 1st Qu.: 354.0 1st Qu.: 24.15 1st Qu.: 0.7406
## Median : 790.0 Median : 645.0 Median : 40.11 Median : 2.5060
## Mean : 868.1 Mean : 736.6 Mean : 42.58 Mean : 5.4716
## 3rd Qu.:1164.0 3rd Qu.: 996.0 3rd Qu.: 59.47 3rd Qu.: 6.2941
## Max. :5181.0 Max. :6948.0 Max. :100.00 Max. :80.9949
## NA's :62 NA's :62 NA's :62 NA's :141
## median_smoc_mortgage median_gross_rent avg_h_cost autos_per_hh_renters
## Min. : 720 Min. : 276 Min. : 450.2 Min. :0.1193
## 1st Qu.:1656 1st Qu.:1078 1st Qu.:1329.3 1st Qu.:1.3527
## Median :2079 Median :1353 Median :1708.3 Median :1.5912
## Mean :2186 Mean :1452 Mean :1832.2 Mean :1.6199
## 3rd Qu.:2600 3rd Qu.:1737 3rd Qu.:2210.0 3rd Qu.:1.8593
## Max. :4001 Max. :3501 Max. :3987.7 Max. :4.0889
## NA's :233 NA's :120 NA's :277 NA's :140
## autos_per_hh_owner autos_per_hh avg_hh_size_owners avg_hh_size
## Min. :0.4818 Min. :0.1463 Min. : 1.02 Min. :1.020
## 1st Qu.:1.9706 1st Qu.:1.6340 1st Qu.: 2.54 1st Qu.:2.540
## Median :2.1945 Median :1.9089 Median : 2.95 Median :2.960
## Mean :2.1709 Mean :1.8927 Mean : 3.06 Mean :3.032
## 3rd Qu.:2.4025 3rd Qu.:2.1866 3rd Qu.: 3.48 3rd Qu.:3.480
## Max. :4.2000 Max. :3.3929 Max. :11.78 Max. :9.500
## NA's :190 NA's :137 NA's :62 NA's :62
## area_income_renter_frac median_hh_income median_rooms_per_renter_hu
## Min. :0.01215 Min. : 4774 Min. :1.300
## 1st Qu.:0.54184 1st Qu.: 44032 1st Qu.:3.800
## Median :0.72329 Median : 62324 Median :4.200
## Mean :0.81253 Mean : 69545 Mean :4.406
## 3rd Qu.:0.98821 3rd Qu.: 86875 3rd Qu.:4.900
## Max. :4.01828 Max. :250001 Max. :9.000
## NA's :62 NA's :79 NA's :62
## median_rooms_per_owner_hu
## Min. :1.400
## 1st Qu.:5.300
## Median :5.800
## Mean :5.825
## 3rd Qu.:6.300
## Max. :9.000
## NA's :62
ggplot(cali_df, aes(avg_h_cost, pct_renters)) +
geom_point() +
geom_point(data = cali_df, colour = '#964000',
alpha = 1/5) +
labs(x = "Average House Cost per Month", y = "Percent Renters",
title = "Average House Cost per Month to Percent Renters in California")
## Warning: Removed 277 rows containing missing values (geom_point).
## Warning: Removed 277 rows containing missing values (geom_point).

ggplot(cali_df, aes(median_hh_income, pct_renters)) +
geom_point() +
geom_point(data = cali_df, colour = '#964000',
alpha = 1/5) +
labs(x = "Median Household Income", y = "Percent Renters",
title = "Median Household Income to Percent Renters in California")
## Warning: Removed 79 rows containing missing values (geom_point).
## Warning: Removed 79 rows containing missing values (geom_point).

ggplot(cali_df, aes(households, median_gross_rent)) +
geom_point() +
geom_point(data = cali_df, colour = '#964000',
alpha = 1/5) +
labs(x = "Quantity of Households in Region", y = "Median Gross Rent",
title = "Quantity of Households in Region to Median Gross Rent in
California")
## Warning: Removed 120 rows containing missing values (geom_point).
## Warning: Removed 120 rows containing missing values (geom_point).

# Georgia
georgia_df <- df1[ which(df1$STUSAB=='GA'), ]
summary(georgia_df)
## OBJECTID GEOID STATE COUNTY
## Min. :17707 Min. :1.300e+10 Min. :13 Min. : 1.0
## 1st Qu.:18781 1st Qu.:1.307e+10 1st Qu.:13 1st Qu.: 67.0
## Median :19276 Median :1.312e+10 Median :13 Median :121.0
## Mean :19265 Mean :1.313e+10 Mean :13 Mean :132.4
## 3rd Qu.:19949 3rd Qu.:1.319e+10 3rd Qu.:13 3rd Qu.:185.0
## Max. :21541 Max. :1.332e+10 Max. :13 Max. :321.0
##
## TRACT CNTY_FIPS STUSAB households
## Min. : 100 Min. :13001 Length:1964 Min. : 20
## 1st Qu.: 10507 1st Qu.:13067 Class :character 1st Qu.:1188
## Median : 30342 Median :13121 Mode :character Median :1731
## Mean :221987 Mean :13132 Mean :1849
## 3rd Qu.:130605 3rd Qu.:13185 3rd Qu.:2346
## Max. :980000 Max. :13321 Max. :7857
## NA's :11
## owner_occupied_hu renter_occupied_hu pct_renters pct_transit_j2w
## Min. : 0 Min. : 16.0 Min. : 1.311 Min. : 0.0000
## 1st Qu.: 623 1st Qu.: 309.0 1st Qu.: 18.011 1st Qu.: 0.0000
## Median :1038 Median : 556.0 Median : 28.720 Median : 0.4381
## Mean :1160 Mean : 688.8 Mean : 32.815 Mean : 2.6212
## 3rd Qu.:1526 3rd Qu.: 933.0 3rd Qu.: 45.085 3rd Qu.: 2.2729
## Max. :5896 Max. :3348.0 Max. :100.000 Max. :47.2410
## NA's :11 NA's :11 NA's :11 NA's :27
## median_smoc_mortgage median_gross_rent avg_h_cost autos_per_hh_renters
## Min. : 517 Min. : 249.0 Min. : 307.9 Min. :0.374
## 1st Qu.:1032 1st Qu.: 688.0 1st Qu.: 904.7 1st Qu.:1.173
## Median :1195 Median : 871.0 Median :1067.1 Median :1.394
## Mean :1311 Mean : 924.8 Mean :1161.0 Mean :1.412
## 3rd Qu.:1458 3rd Qu.:1089.0 3rd Qu.:1310.9 3rd Qu.:1.636
## Max. :4001 Max. :3250.0 Max. :3870.0 Max. :3.139
## NA's :43 NA's :27 NA's :57 NA's :26
## autos_per_hh_owner autos_per_hh avg_hh_size_owners avg_hh_size
## Min. :0.8991 Min. :0.374 Min. :0.5225 Min. :1.300
## 1st Qu.:1.8738 1st Qu.:1.547 1st Qu.:2.4500 1st Qu.:2.480
## Median :2.0794 Median :1.845 Median :2.7000 Median :2.710
## Mean :2.0314 Mean :1.788 Mean :2.6934 Mean :2.709
## 3rd Qu.:2.2410 3rd Qu.:2.068 3rd Qu.:2.9300 3rd Qu.:2.940
## Max. :2.8323 Max. :2.748 Max. :8.5300 Max. :4.210
## NA's :36 NA's :26 NA's :11 NA's :13
## area_income_renter_frac median_hh_income median_rooms_per_renter_hu
## Min. :0.04259 Min. : 5625 Min. :2.600
## 1st Qu.:0.50145 1st Qu.: 35022 1st Qu.:4.500
## Median :0.65662 Median : 45860 Median :5.000
## Mean :0.72255 Mean : 52323 Mean :5.092
## 3rd Qu.:0.85882 3rd Qu.: 63246 3rd Qu.:5.500
## Max. :3.09670 Max. :187750 Max. :9.000
## NA's :11 NA's :12 NA's :11
## median_rooms_per_owner_hu
## Min. : 2.200
## 1st Qu.: 6.000
## Median : 6.300
## Mean : 6.535
## 3rd Qu.: 7.000
## Max. :10.829
## NA's :11
ggplot(georgia_df, aes(avg_h_cost, pct_renters)) +
geom_point() +
geom_point(colour = '#247B45') +
labs(x = "Average House Cost per Month", y = "Percent Renters",
title = "Average House Cost per Month to Percent Renters in Georgia")
## Warning: Removed 57 rows containing missing values (geom_point).
## Warning: Removed 57 rows containing missing values (geom_point).

ggplot(georgia_df, aes(median_hh_income, pct_renters)) +
geom_point() +
geom_point(colour = '#247B45') +
labs(x = "Median Household Income", y = "Percent Renters",
title = "Median Household Income to Percent Renters in Georgia")
## Warning: Removed 12 rows containing missing values (geom_point).
## Warning: Removed 12 rows containing missing values (geom_point).

ggplot(georgia_df, aes(households, median_gross_rent)) +
geom_point() +
geom_point(colour = '#247B45') +
labs(x = "Quantity of Households in Region", y = "Median Gross Rent",
title = "Quantity of Households in Region to Median Gross Rent in Georgia")
## Warning: Removed 27 rows containing missing values (geom_point).
## Warning: Removed 27 rows containing missing values (geom_point).

# Histogram of Idaho Rent v Ownership
hist(idaho_df$avg_h_cost,
breaks = 14,
freq = F,
xlim = c(0, 2000),
ylim = c(0, 0.003),
col = "#6495ED",
main = paste("Cost of Ownership vs Rent in Idaho"),
xlab = "Cost")
lines(density(idaho_df$median_gross_rent, na.rm = T), col = "#bca288", lwd = 2)
legend("topright", c("Median Gross Rent", "Average House Cost"),col=c("#bca288", "#6495ed"), lwd=5)

# Histogram of California Rent vs Ownership
hist(cali_df$avg_h_cost,
breaks = 18,
freq = F,
xlim = c(0, 5000),
ylim = c(0, 0.001),
col = "#964000",
main = paste("Cost of Rent vs Ownership in California"),
xlab = "Cost")
lines(density(cali_df$median_gross_rent, na.rm = T), col = "#bca288", lwd = 2)
legend("topright", c("Median Gross Rent", "Average House Cost"),col=c("#bca288", "#964000"), lwd=5)

# Histogram of Georgia Rent vs Ownership
hist(georgia_df$avg_h_cost,
breaks = 14,
freq = F,
xlim = c(0, 5000),
ylim = c(0, 0.0015),
col = "#247B45",
main = paste("Cost of Georgia Rent vs Ownership"),
xlab = "Cost")
lines(density(georgia_df$median_gross_rent, na.rm = T), col = "#bca288", lwd = 2)
legend("topright", c("Median Gross Rent", "Average House Cost"),col=c("#bca288", "#247b45"), lwd=5)

# National Household Income, with Georgia, Idaho, California as examples
hist(df1$median_hh_income,
breaks = 14,
freq = F,
col = '#36454F',
xlim = c(0, 280000),
ylim = c(0, 0.00003),
main = paste('Histogram of National Median Household Income'),
xlab = "Income"
)
lines(density(georgia_df$median_hh_income, na.rm = T), col = '#247b45', lwd = 2)
lines(density(cali_df$median_hh_income, na.rm = T), col = '#964000', lwd = 2)
lines(density(idaho_df$median_hh_income, na.rm = T), col = '#6495ED', lwd = 2)
legend("topright", c("Georgia", "California", "Idaho", "National"),col=c("#247b45", "#964000", "#6495ED", "#36454F"), lwd=5)
